<script setup lang="ts">
import { EditForm } from '@widgets/EditForm';
import { Subject } from 'rxjs'
import { EditView } from '@ibiz-core'
import { ViewConfig } from './view-config'
import { IbizDefaultViewLayout, IbizIconText } from '@components';
import imgUrl from '@static/assets/imgs/icon-vue.png'


// props声明和默认值处理
interface Props {
  context: any
  viewParams?: any
  viewSubject?: Subject<any>
}

const props = withDefaults(defineProps<Props>(), {
  // 设定默认值,可选属性可以在这初始化
  viewSubject: () => new Subject<any>(),
})

// 安装功能模块，提供状态和能力方法
const { state } = new EditView(ViewConfig).moduleInstall(props)

IbizIconText

</script>

<template>
  <IbizDefaultViewLayout viewCaption="编辑视图" class="ibiz-edit-view">
    <template v-slot:header-left>
      <IbizIconText class="ibiz-view__caption" size="large" text="编辑视图" :imgPath="imgUrl" />
    </template>
    <template v-slot:header-right>
      <span>工具栏部件</span>
    </template>
    <EditForm
      :showBusyIndicator="true"
      :context="state.context"
      :viewParams="state.viewParams"
      :controlAction="state.controlsAction.form"
      :viewSubject="state.viewSubject"
    ></EditForm>
  </IbizDefaultViewLayout>
</template>

<style scoped>
.ibiz-view-container {
  height: 100%;
  width: 100%;
}
</style>